// pages/showaddress/showaddress.js
var util = require('../../utils/util.js');
var app = getApp();
Page({
  data:{
    dialog3: {
      hidden: true,
    },
    json:"",
    ynumber:"",
    yfilename:"",
    yfilename1:"",
    yfilename2:"",
    yname:"",
    yowner:"",
    ysex:"",
    index: 0
   
  },
  onLoad:function(options){
    var ss = options.a.split(",")
    var b = options.b;
    var aa = options.aa;
    var dd = options.dd;
    var ee = options.ee;
    var ff = options.ff;
    this.setData({ ynumber: b });
    this.setData({ yfilename: aa });
    this.setData({ yname: dd });
    this.setData({ yowner: ee });
    this.setData({ ysex: ff });
   
    // 页面初始化 options为页面跳转所带来的参数
    this.setData({ json: ss});


  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  address:function(e){
    
    this.setData({ 'dialog3.hidden': false });
    /*wx.switchTab({
      url: '../../pages/unitdoor/unitdoor'
    })*/
    var that = this;
    var address = e.currentTarget.id;
    app.owner.address = address;
    app.owner.ynumber = that.data.ynumber;
    app.owner.yfilename = that.data.yfilename;
    app.owner.yname = that.data. yname;
    app.owner.yowner = that.data.yowner;
    app.owner.ysex = that.data.ysex;

    var data = {community_name: address}
    util.ajax("post", "/smallRoutineController/showtoMdmBuilding", data, function (res) {
      debugger;
      var reso = res;
      var json = JSON.stringify(reso);
      app.owner.unitdoorJson = json;
      that.setData({ unitdoor: res.list});
        that.setData({ 'dialog3.hidden': true })
        wx.navigateTo({
          url: '../../pages/unitdoorfk/unitdoorfk'
        })
    })

    
  }
})